#include<iostream>
using namespace std;
#include <string.h>
class Person
{
public:
  Person()
 {
   cout << "构造函数的调用" << endl;
 
 }
  Person(int a,int b):m_a(10)
  {
    cout << "有参构造函数" << endl;
    m_a = a;
    m_b = new int(b);
  }
  Person(const Person &a)
  {
    cout << "拷贝构造函数" << endl;
    m_a = a.m_a;
    m_b = new int(*(a.m_b));
  }

  ~Person()
  {
   cout << "析构函数的调用" << endl;
    if(m_b != NULL)
    {
      delete m_b;
      m_b = NULL;
    }
  }

  int m_a;
  int* m_b;
  private:



};



void text()
{

  Person p1 = Person(10,20);
  Person p2 = Person(p1);

  cout << "p.m_a:" << p1.m_a  << endl;
  cout << "p.m_a:" << *p1.m_b  << endl;
  cout << "p.m_a:" << p2.m_a  << endl;
  cout << "p.m_a:" << *p2.m_b  << endl;
}


int main()
{
  text();
  //text1();
  return 0;
}
